﻿using System;
using System.Collections.Generic;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cineman
{
    class Settings
    {
        public static string LiveTileOn { get; set; }
        public static string DisplayLanguage { get; set; }

        public static void SaveSettings()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
            if (settings.Keys.Count == 0)
            {
                if (!(LiveTileOn == null)) { settings.Add("LiveTilesOn", LiveTileOn); }
                if (!(DisplayLanguage == null)) { settings.Add("Language", DisplayLanguage); }
                settings.Save();
            }
            else
            {
                if (!(LiveTileOn == null)) { settings["LiveTilesOn"] = LiveTileOn; }
                if (!(DisplayLanguage == null)) { settings["Language"] = DisplayLanguage; }
                settings.Save();
            }
        }

        public static void LoadSettings()
        {
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
            if (settings.Keys.Count > 0)
            {
                LiveTileOn = settings["LiveTilesOn"] as string;
                DisplayLanguage = settings["Language"] as string;
            }
            else
            {
                LiveTileOn = "true";
                DisplayLanguage = "" + 0;
            }
        }
    }
}
